import React from "react";

const importAll = (requireContext: __WebpackModuleApi.RequireContext) =>
  requireContext.keys().forEach(requireContext);
try {
  importAll(require.context("../asserts/svg", true, /\.svg$/));
} catch (error) {
  console.log(error);
}

type Props = {
  name: string;
  style?: Object;
};

function Icon(props: Props) {
  return (
    <svg className="icon" style={props.style}>
      <use xlinkHref={"#" + props.name} />
    </svg>
  );
}

export default Icon;
